-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Test Coverage for Dominant Color Images Plugin #1837
base: trunk
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## trunk #1837 +/- ##
==========================================
+ Coverage 65.89% 67.07% +1.18%
==========================================
Files 88 87 -1
Lines 6878 6873 -5
==========================================
+ Hits 4532 4610 +78
+ Misses 2346 2263 -83
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -42,7 +42,7 @@ public function test_dominant_color_metadata( string $image_path, array $expecte | |||
* | |||
* @dataProvider provider_get_dominant_color | |||
* | |||
* @covers ::dominant_color_get_dominant_color | |||
* @covers helper::dominant_color_get_dominant_color |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem right? The ::
here refers to the global namespace.
* @covers helper::dominant_color_get_dominant_color | |
* @covers ::dominant_color_get_dominant_color |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
::
refers to the global namespace, and it works for rest of the functions however, when I'm trying to generate coverage report, for the functions where I've added helper
& hooks
it's showing 0 coverage without file reference.
Previous Result :
-
When setting annotation to
* @covers ::dominant_color_get_dominant_color
&* @covers ::dominant_color_img_tag_add_dominant_color
-
helper.php
![image](https://private-user-images.githubusercontent.com/69689387/408781167-0c0250e4-b27e-4e2e-aa18-9d1ee6e88f96.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NTgyOTUsIm5iZiI6MTcz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WC1BbXotU2lnbmF0dXJlPTViN2IyMjFjNjE1NmZjZDRiMDRiYTkxYzQzY2RiMGNjZTFhZjc0ZDQ2YjAwOGRkZWViZDMzZDBkMTA2NGZjZTImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.4-dGkaHj_cBGI0mWS7lrHcXH8PAK1p8Gq1eS-ISXNVA)
New Result :
-
When setting annotation to
* @covers helper::dominant_color_get_dominant_color
&* @covers hooks::dominant_color_img_tag_add_dominant_color
-
helper.php
![image](https://private-user-images.githubusercontent.com/69689387/408781348-e3efde93-4260-4872-8904-cae8bb862f53.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NTgyOTUsIm5iZiI6MTczOTQ1Nzk5NSwicGF0aCI6Ii82OTY4OTM4Ny80MDg3ODEzNDgtZTNlZmRlOTMtNDI2MC00ODcyLTg5MDQtY2FlOGJiODYyZjUzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDE0NDYzNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg0MTRkNGRmNzE4YjVlM2U1MDVmNjY0N2FmY2Y0MmZjOTMyMDIxZTcxYTAxOTcyYjI1ZmJiN2FiMTU2Y2ZkYWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.WTWd_Azfsd__Q_0CJhj4248qGbz1I6BIh9ZYPmw51oA)
hooks.php
![image](https://private-user-images.githubusercontent.com/69689387/408781328-a6e6761a-93ee-4daa-93ba-7a872a5b0059.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NTgyOTUsIm5iZiI6MTczOTQ1Nzk5NSwicGF0aCI6Ii82OTY4OTM4Ny80MDg3ODEzMjgtYTZlNjc2MWEtOTNlZS00ZGFhLTkzYmEtN2E4NzJhNWIwMDU5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDE0NDYzNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM2NGNhNjlmZWMyMWIxNzFjYzU1NzlmZGMxYzE3NzRjMTllODAzOTdmMzFjZmRhZTljNGI2ZmRkNjFkNjZiYmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.dhmS6dGvPrdHoX_uBnmcbd7womaepNdGf7CL0OhJ7yU)
So how should I proceed with this since helper.php
& hooks.php
file don't have a class so ClassName:functionName
annotations will not work I also tried adding namespace to helper.php
& hooks.php
but it results in failing all the test cases and throws error?
cc : @westonruter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange. I don't know why that would be. I also don't understand adding hooks
and helper
to the beginning of those functions. They would seem to indicate there are classes called hooks
and helper
, which there aren't.
You're seeing this with local coverage report, but are you also seeing it with the Codecov coverage report?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They would seem to indicate there are classes called hooks and helper, which there aren't.
Exactly, still for some reason it seems to work.
You're seeing this with local coverage report, but are you also seeing it with the Codecov coverage report?
Yes, in Codecov coverage report also the same is happening.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thelovekesh any ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sarthak-19 can you please upload the xml coverage report? maybe that can help analyze how code coverage driver is looking for things?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thelovekesh Here's the link to xml report : https://drive.google.com/drive/folders/1Mj8KLo6IcnqsYstaZkRekREtkBzn0-9z?usp=sharing
@@ -91,7 +91,7 @@ public function test_has_transparency_metadata( string $image_path, array $expec | |||
* | |||
* @dataProvider provider_get_dominant_color | |||
* | |||
* @covers ::dominant_color_get_dominant_color | |||
* @covers helper::dominant_color_get_dominant_color |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @covers helper::dominant_color_get_dominant_color | |
* @covers ::dominant_color_get_dominant_color |
@@ -113,7 +113,7 @@ public function test_dominant_color_has_transparency( string $image_path, array | |||
* | |||
* @dataProvider provider_get_dominant_color | |||
* | |||
* @covers ::dominant_color_img_tag_add_dominant_color | |||
* @covers hooks::dominant_color_img_tag_add_dominant_color |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @covers hooks::dominant_color_img_tag_add_dominant_color | |
* @covers ::dominant_color_img_tag_add_dominant_color |
@@ -199,7 +199,7 @@ public function data_dominant_color_img_tag_add_dominant_color_requires_proper_q | |||
* | |||
* @dataProvider data_provider_dominant_color_check_inline_style | |||
* | |||
* @covers ::dominant_color_img_tag_add_dominant_color | |||
* @covers hooks::dominant_color_img_tag_add_dominant_color |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @covers hooks::dominant_color_img_tag_add_dominant_color | |
* @covers ::dominant_color_img_tag_add_dominant_color |
plugins/dominant-color-images/tests/test-dominant-color-image-editor-imagick.php
Outdated
Show resolved
Hide resolved
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @[email protected]. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Summary
This is part of #1789:
@covers
Annotationscc : @westonruter